#include <iostream>
using namespace std;

int summ=0;
int c[20];

template <class T>
void subv(T a[],int m,int n,T c[]) {
    if (m==n) {
        int sum=0;
        int count=0;
        for (int i=0;i<n;i++) {
            if (c[i]) {
                count++;
                sum+=count*a[i];
            }
        }
        // for (int i=0;i<n;i++) {
        //     cout <<"c[i]=" << c[i] ;
        // }
        // cout << endl;
        //cout <<"sum=" << sum << endl;
        summ=summ^sum;
        sum=0;
    }
    else if(m<n) {
        c[m]=0;
        subv(a,m+1,n,c);
        c[m]=1;
        subv(a,m+1,n,c);
    }
}

int main() {
    int n;
    cin >> n;
    int* a = new int(n);
    //int* c = new int(n+1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    subv(a,0,n,c);
    cout << summ;
    return 0;
}